package com.ser02;


import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/ServletTest8")
public class ServletTest8 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("执行了ServletTest8...");

        //RequestDispatcher requestDispatcher = request.getRequestDispatcher("/ServletTest9");
        //requestDispatcher.forward(request, response);
        //简写成如下
//        request.getRequestDispatcher("/ServletTest9").forward(request, response);
        request.getRequestDispatcher("/demo04.html").forward(request, response);

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req,resp);
    }
}
